function OpenWindow(VS)
sca;
close all;
PsychDefaultSetup(2);

% Get the screen numbers
screens = Screen('Screens');

% Draw to the external screen if avaliable
screenNumber = max(screens);
%global window white black  windowRect screenXpixels screenYpixels ifi xCenter yCenter
% Define black and white
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);

% Open an on screen window
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, black);

% Get the size of the on screen window
[screenXpixels, screenYpixels] = Screen('WindowSize', window);

% Query the frame duration
ifi = Screen('GetFlipInterval', window);

% Get the centre coordinate of the window
[xCenter, yCenter] = RectCenter(windowRect);

Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
SetMouse(screenXpixels,screenYpixels, window);
% save info
VS.WindowInfo.white=white;
VS.WindowInfo.black=black;
VS.WindowInfo.window=window;
VS.WindowInfo.windowRect=windowRect;
VS.WindowInfo.screenXpixels=screenXpixels;
VS.WindowInfo.screenYpixels=screenYpixels;
VS.WindowInfo.ifi=ifi;
VS.WindowInfo.xCenter=xCenter;
VS.WindowInfo.yCenter=yCenter;
